perm filename VIKTAP.SAI[PIX,HPM] blob
sn#298675 filedate 1977-08-09 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00002 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 begin "viking"
C00009 ENDMK
C⊗;
begin "viking"
require "sail.hdr[s,pmf]" source_file;
integer array p[0:200];
integer i,j,k,l,br,eof0,eof1,iflag,oflag;
integer mode;
! integer width;
integer ip,op,t,ipt,opt;
string s,ifile,ofile;
DEFINE PCLN=0; comment index of word in a picture file containing
number of scanlines in the picture;
DEFINE PCWD=1; comment number of words in the picture;
DEFINE PCBY=2; comment number of valid bytes in the picture;
DEFINE PCBYA=3; comment no. of bytes including the nulls at the end of lines;
DEFINE LNWD=4; comment no. of words per scanline;
DEFINE LNBY=5; comment no. of valid bytes per scanline;
DEFINE LNBYA=6; comment no. of bytes per scanline, including the nulls;
DEFINE WDBY=7; comment no. of bytes per word;
DEFINE WDBI=8; comment no. of bits containing data in a word;
DEFINE BYBI=9; comment no. of bits per byte;
DEFINE BMAX=10; comment largest value of a byte;
DEFINE BPTAB=11; comment address of second entry in byte pntr. table;
DEFINE LINTAB=12; comment actual address of the first entry in the row table;
INTEGER PROCEDURE MAKPIX(INTEGER HEIGHT,WIDTH,BITS; REFERENCE INTEGER PICTURE);
comment actually creates an empty picture HEIGHT by WIDTH by BITS in
the area of core beginning with PICTURE. Returns its size.;
BEGIN
INTEGER XPCLN,XPCWD,XPCBY,XPCBYA,XLNWD,XLNBY,XLNBYA,XWDBY,XWDBI,XBYBI;
INTEGER I,L;
L←LOCATION(PICTURE);
MEMORY[L+BYBI]←XBYBI←BITS;
MEMORY[L+LNBY]←XLNBY←WIDTH;
MEMORY[L+PCLN]←XPCLN←HEIGHT;
MEMORY[L+WDBY]←XWDBY←36%XBYBI;
MEMORY[L+LNWD]←XLNWD←(XLNBY+XWDBY-1)%XWDBY;
MEMORY[L+LNBYA]←XLNBYA←XLNWD*XWDBY;
MEMORY[L+PCWD]←XPCWD←XPCLN*XLNWD;
MEMORY[L+PCBY]←XPCBY←XPCLN*XLNBY;
MEMORY[L+PCBYA]←XPCBYA←XPCLN*XLNBYA;
MEMORY[L+WDBI]←XWDBI←XWDBY*XBYBI;
MEMORY[L+BMAX]←(1 LSH XBYBI)-1;
MEMORY[L+BPTAB]←13+XPCLN+L;
RETURN(13+XPCLN+XLNBYA+XPCWD);
END;
INTEGER PROCEDURE PUTPFL(REFERENCE INTEGER PICTURE; integer chan);
comment write out the picture in the core area starting with
PICTURE, creating a file called FILNAM. Returns
the size of the original file on success, else 0.;
BEGIN
INTEGER XXCOUNT,XXBRCHAR,XXEOF,XXPICLOC; BOOLEAN XXFLAG;
INTEGER XPCLN,XPCWD,XPCBY,XPCBYA,XLNWD,XLNBY,XLNBYA,XWDBY,XWDBI,XBYBI;
INTEGER I,L;
INTEGER ARRAY BUF[0:'177];
L←LOCATION(PICTURE);
BUF[0]←-1;
BUF[1]←XBYBI←MEMORY[L+BYBI];
BUF[2]←XLNWD←MEMORY[L+LNWD];
BUF[3]←1; BUF[4]←XPCLN←MEMORY[L+PCLN];
BUF[5]←1; BUF[6]←XLNBY←MEMORY[L+LNBY];
BUF[7]←((-(XPCWD←MEMORY[L+PCWD])) LSH 18) LOR '200;
XWDBY←36%XBYBI;
XLNWD←(XLNBY+XWDBY-1)%XWDBY;
XLNBYA←XLNWD*XWDBY;
ARRYOUT(chan,BUF[0],'200);
RETURN(13+XPCLN+XLNBYA+XPCWD);
END;
define height=1640;
define width=4345;
mode←'10;
OPEN(0,"MTA0",mode,xwd(967,3),0,0,BR,EOF0); ! 956;
SETSTS(0,'600); COMMENT set 800 bpi ;
mtape(0,"w");
OPEN(1,"UDP",mode,0,19,0,BR,EOF1);
OUTSTR("OUTPUT FILE (ON UDP) ← ");
OFILE←INCHWL;
ENTER(1,OFILE,OFLAG);
makpix(height,width,8,p[0]);
putpfl(p[0],1);
for i←1 step 1 until 480 do wordin(0); ! first 400 words are text;
ipt←point(4,p[0],-1);
opt←point(4,p[10],-1);
define conv(x)=" ! x is number of pixels;
begin
arryin(0,p[0],(2*x+8) div 9); ! 8 words into 9 words;
ip←ipt; op←opt;
for l←1 step 1 until 2*x do
begin
idpb(ildb(ip),op);
if (l mod 8) = 0 then idpb(0,op);
end;
arryout(1,p[10],(x+3) div 4);
end
";
define a='14;
define b='15;
define c='16;
define conv36="conv(36)";
j←0;
while ¬eof0 ∧ j<height do
begin
j←j+1;
for i←36 step 36 until width do conv36;
conv(width mod 36);
end;
print("lines=",j," eof=",eof0);
release(1);
mtape(0,"w"); ! rewind mag tape;
release(0);
end "viking"